﻿<!DOCTYPE html>
<html>
  <head>
    <title>index</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <link href="resources/css/jquery-ui-themes.css" type="text/css" rel="stylesheet"/>
    <link href="resources/css/axure_rp_page.css" type="text/css" rel="stylesheet"/>
    <link href="data/styles.css" type="text/css" rel="stylesheet"/>
    <link href="files/index/styles.css" type="text/css" rel="stylesheet"/>
    <script src="../js/axios.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../js/vue.min.js" ></script>
  </head>
  <body>
  	<div id="app">
	  	<div id="base" class="" v-show="divshow">
	
	      <!-- Unnamed (矩形) -->
	      <div id="u0" class="ax_default box_1">
	        <div id="u0_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u1" class="text" style="display: none; visibility: hidden">
	          <p><span></span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u2" class="ax_default _三级标题">
	        <div id="u2_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u3" class="text" style="visibility: visible;">
	          <p><span>账户：</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (文本框) -->
	      <div id="u4" class="ax_default text_field">
	        <input id="u4_input" type="text" v-model="uname"/>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u5" class="ax_default label">
	        <div id="u5_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u6" class="text" style="visibility: visible;">
	          <p><span>{{unamemsg}}</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u7" class="ax_default _三级标题">
	        <div id="u7_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u8" class="text" style="visibility: visible;">
	          <p><span>密码：</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (文本框) -->
	      <div id="u9" class="ax_default text_field">
	        <input id="u9_input" type="password" v-model="upwd"/>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u10" class="ax_default label">
	        <div id="u10_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u11" class="text" style="visibility: visible;">
	          <p><span>{{upwdmsg}}</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u12" class="ax_default _三级标题">
	        <div id="u12_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u13" class="text" style="visibility: visible;">
	          <p><span>确认密码：</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (文本框) -->
	      <div id="u14" class="ax_default text_field">
	        <input id="u14_input" type="password" value=""/>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u15" class="ax_default label">
	        <div id="u15_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u16" class="text" style="visibility: visible;">
	          <p><span>提示信息</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u17" class="ax_default _三级标题">
	        <div id="u17_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u18" class="text" style="visibility: visible;">
	          <p><span>真实姓名：</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (文本框) -->
	      <div id="u19" class="ax_default text_field">
	        <input id="u19_input" type="text" v-model="realname"/>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u20" class="ax_default label">
	        <div id="u20_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u21" class="text" style="visibility: visible;">
	          <p><span>提示信息</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u22" class="ax_default _三级标题">
	        <div id="u22_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u23" class="text" style="visibility: visible;">
	          <p><span>电话：</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (文本框) -->
	      <div id="u24" class="ax_default text_field">
	        <input id="u24_input" type="tel" v-model="uphone"/>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u25" class="ax_default label">
	        <div id="u25_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u26" class="text" style="visibility: visible;">
	          <p><span>提示信息</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u27" class="ax_default _三级标题">
	        <div id="u27_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u28" class="text" style="visibility: visible;">
	          <p><span>邮箱：</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (文本框) -->
	      <div id="u29" class="ax_default text_field">
	        <input id="u29_input" type="email" v-model="uemail"/>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u30" class="ax_default label">
	        <div id="u30_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u31" class="text" style="visibility: visible;">
	          <p><span>提示信息</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u32" class="ax_default _三级标题">
	        <div id="u32_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u33" class="text" style="visibility: visible;">
	          <p><span>性别：</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u34" class="ax_default label">
	        <div id="u34_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u35" class="text" style="visibility: visible;">
	          <p><span>提示信息</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u36" class="ax_default _三级标题">
	        <div id="u36_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u37" class="text" style="visibility: visible;">
	          <p><span>年龄：</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (文本框) -->
	      <div id="u38" class="ax_default text_field">
	        <input id="u38_input" type="number" v-model="uage"/>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u39" class="ax_default label">
	        <div id="u39_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u40" class="text" style="visibility: visible;">
	          <p><span>提示信息</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u41" class="ax_default button">
	        <div id="u41_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u42" class="text" style="visibility: visible; cursor: pointer;"  >
	          <p><span>重置</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u43" class="ax_default primary_button">
	        <div id="u43_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u44" class="text" style="visibility: visible; cursor: pointer;" @click="sub()">
	          <p><span>提交</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u45" class="ax_default _三级标题">
	        <div id="u45_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u46" class="text" style="visibility: visible;">
	          <p><span>地区：</span></p>
	        </div>
	      </div>
	
	      <!-- Unnamed (下拉列表框) -->
	      <div id="u47" class="ax_default droplist">
	        <select id="u47_input" v-model="shengid" @change="getAllshi()">
	        	<option value="0">---请选择----</option>
	        	<option v-for="item in shenglist" :value="item.id">{{item.cname}}</option>
	        </select>
	      </div>
	
	      <!-- Unnamed (下拉列表框) -->
	      <div id="u48" class="ax_default droplist">
	        <select id="u48_input" v-model="shiid" @change="getAllqu()">
	        	<option value="0">---请选择----</option>
	        	<option v-for="item in shilist" :value="item.id">{{item.cname}}</option>	        	
	        </select>
	      </div>
	
	      <!-- Unnamed (下拉列表框) -->
	      <div id="u49" class="ax_default droplist">
	        <select id="u49_input" v-model="quid" @change="showquid()">
	        	<option value="0">---请选择----</option>
	        	<option v-for="item in qulist" :value="item.id">{{item.cname}}</option>		        	
	        </select>
	      </div>
	
	      <!-- Unnamed (单选按钮) -->
	      <div id="u50" class="ax_default radio_button">
	        <label for="u50_input">
	          <!-- Unnamed () -->
	          <div id="u51" class="text" style="visibility: visible;">
	            <p><span>男</span></p>
	          </div>
	        </label>
	        <input id="u50_input" type="radio" value="男" v-model="xingbie" name="u50"/>
	      </div>
	
	      <!-- Unnamed (单选按钮) -->
	      <div id="u52" class="ax_default radio_button">
	        <label for="u52_input">
	          <!-- Unnamed () -->
	          <div id="u53" class="text" style="visibility: visible;">
	            <p><span>女</span></p>
	          </div>
	        </label>
	        <input id="u52_input" type="radio" value="女" v-model="xingbie" name="u50"/>
	      </div>
	
	      <!-- Unnamed (矩形) -->
	      <div id="u54" class="ax_default label">
	        <div id="u54_div" class=""></div>
	        <!-- Unnamed () -->
	        <div id="u55" class="text" style="visibility: visible;">
	          <p><span><a href="javascript:void(0);" v-on:click="hiddiv()">关闭</a></span></p>
	        </div>
	      </div>
	    </div>
	    
	  <!-- Unnamed (矩形) -->
	  	<div id="u56" class="ax_default label">
	    	<div id="u56_div" class=""></div>
	    	<!-- Unnamed () -->
	    	<div id="u57" class="text" style="visibility: visible;">
	      	<p><span><a href="javascript:void(0);" @click="showdiv()">注册</a></span></p>
	    	</div>
	  	</div>
	  	
  	</div>
  	<script>
  		var vue = new Vue({
  			el: '#app',
  			data: {
  				divshow: false,
  				uname: "",
  				unamemsg: "",
  				upwd: "",
  				xingbie: "男",
  				shenglist: [],
  				shengid: 0,
  				shilist: [],
  				shiid: 0,
  				qulist: [],
  				quid: 0,
  				realname: "",
  				uphone: "",
  				uemail: "",
  				uage: 0,
  				dqid: 0
  			},
  			methods: {
  				showdiv: function() {
  					this.divshow = true;
  				},
  				hiddiv: function() {
  					this.divshow = false;
  				},
					sub: function() {
						var u = new URLSearchParams();
						u.append("uname",vue.uname);
						u.append("upwd", vue.upwd);
						u.append("realname", vue.realname);
						u.append("uphone", vue.uphone);
						u.append("uemail", vue.uemail);
						u.append("uage", vue.uage);
						u.append("xingbie", vue.xingbie);
						u.append("dqid", vue.dqid);
						axios.post("../save", u)
						.then((res)=>{
							if(res.data.msg=="success") {
								alert("注册成功");
							}else {
								alert("注册失败");
							}
						}).catch((error)=>{
							
						})
					},
  				
  				
  				
  				
  				
  				
  				
  				
  				
  				getAllshi: function() {
  					vue.quid = 0;
  					alert(vue.xingbie)
  					alert(vue.shengid);
  					axios.get("../Tsgetbypid?pid="+vue.shengid)
						.then((res)=>{
								vue.shilist = res.data;					
						})
						.catch((error)=>{
							alert("网络异常")
						})
  				},
  				getAllqu: function() {
  					alert(vue.shiid);
  					axios.get("../Tsgetbypid?pid="+vue.shiid)
						.then((res)=>{
							if(res.data.length==0) {
								vue.dqid = vue.shiid;
							}else {
								vue.qulist = res.data;
							}
							
						})
						.catch((error)=>{
							alert("网络异常")
						})
  				},
  				showquid: function() {
  					vue.dqid = vue.shiid;
  					alert(this.quid);
  				}
  			},
  			created: function() {
  				this.shiid = 0;
  				this.quid = 0;
  				//获取所有的市信息
			  	axios.get("../Tsgetbypid?pid=0")
						.then((res)=>{
							alert(res.data);
							vue.shenglist = res.data;
						})
						.catch((error)=>{
							alert("网络异常")
						})
  			},
  			watch:{//监听 当uname值发生改变就会执行,给变量命名时不要命名位关键字
  				uname(newvalue,oldvaluue) {
  					if(newvalue=="") {
  						vue.unamemsg = "不能为空";
  					}else if(newvalue.length<8){
  						vue.unamemsg = "长度不能少于8位";
  					}else{
  						axios.get("../Huiyuangetbyuname?uname="+newvalue)
  							.then((res)=>{
								if(res.data.msg=="success") {
									vue.unamemsg = "此账户已存在";
								}else {
									vue.unamemsg = "";
								}
							})
							.catch((error)=>{
								alert("网络异常")
							})
	  				}
  				}
  			},
  			computed: {
  				upwdmsg: function() {
  					if(this.upwd.length<=6) {
  						return "长度不能小于6位"
  					}
  					return "";
  				}
  			}
  		})
  	</script>
  </body>
</html>
